﻿class Solution
{
public:
	string solve(string s, string t)
	{
		reverse(s.begin(), s.end());
		reverse(t.begin(), t.end());
		int m = s.size(), n = t.size();
		vector<int> tmp(m + n);
		// 1. ⽆进位相乘相加 
		for (int i = 0; i < m; i++)
		{
			for (int j = 0; j < n; j++)
			{
				tmp[i + j] += (s[i] - '0') * (t[j] - '0');
			}
		}
		// 2. 处理进位 
		int c = 0;
		string ret;
		for (auto x : tmp)
		{
			c += x;
			ret += c % 10 + '0';
			c /= 10;
		}
		while (c)
		{
			ret += c % 10 + '0';
			c /= 10;
		}
		// 3. 处理前导零 
		while (ret.size() > 1 && ret.back() == '0') ret.pop_back();

		reverse(ret.begin(), ret.end());
		return ret;
	}
};